<style scoped>


  .info-display {

    margin-top: 10px;
    width: 95%;
    background: rgba(13, 161, 154, 0.4);
    box-shadow: #111 0px 0px 5px;
  }

  .info-display .info-box {

    height: 190px;
    line-height: 190px;
    font-size: 30px;
    text-align: center;
    color: #fff;

  }

  .frame>.rows>.col-xs-5 {

    padding-left: 0px;
    padding-right: 0px;

  }

  .autoControl .btn {

    padding: 10px 25px;
    font-size: 22px;
  }

  .line-simple {

    height: 1px;
    background-color: #FFF;
    width: 90%;
    margin-left: auto;
    margin-right: auto;
  }
</style>
<template>
  <!--页面主体，内容区域-->
  <div class="content">
    <div class="body">
      <div class="frame">

      <div class="rows col-center-block info-display">
          <div class="info-box">温度：{{overviewInfo.tem}}</div>
          <div class="line-simple"></div>
          <div class="info-box autoControl">
            <span style="margin-right: 16px;">当前温控流程:{{temControlflowStr}}</span>
          </div>
          <div class="line-simple"></div>
          <div class="info-box">此柜已累计运行:{{runTimeInfo}}</div>
        </div>
        <div class="rows col-center-block" style="width: 97%;margin-top: 60px">
            <div class="col-xs-6" ><mu-button color="secondary" style="width: 100%; height:130px;font-size: 35px;" @click="toLogin">账号密码登录</mu-button></div>
            <div class="col-xs-6 pull-right" ><mu-button color="secondary" style="width: 100%; height:130px;font-size: 35px;" @click="toFaceLogin">人脸识别认证</mu-button></div>
        </div>
        <div v-show="['620','820','610','810'].indexOf(ClientUseCode)==-1" class="rows col-center-block" style="width: 97%;margin-top: 130px">
          <div class="col-xs-12" ><mu-button color="secondary" style="width: 100%; height:130px;font-size: 35px;" @click="toLogin">账号密码登录</mu-button></div>
          <!-- <div class="col-xs-6 pull-right" ><mu-button color="secondary" style="width: 100%; height:130px;font-size: 35px;" @click="toFaceLogin">人脸识别认证</mu-button></div> -->
      </div>
      </div>
    </div>
  </div>
</template>
<script>
  export default {
    extends: extend,
    name: "standby",
    data: function () {
      return {
        cabNum: -1,
        pageTitle: "待机",
        intervalId: null,
        temControlflowStr:this.$parent.temControlflowStr,
        overviewInfo: {
          returnNum: 0,
          putNum: 0,
          useNum: 0,
          expireNum: 0,
          tem: null,
          hum:null,
        }
      };
    },
    computed: {
      //运行时长显示
      runTimeInfo: function () {

        try {
            console.log(122121212121, this.$parent.clientInfo)
            var totalRunTime = this.$parent.clientInfo.TotalRunTime;

            var h = Math.floor(totalRunTime / 60 / 60);
            var m = Math.floor((totalRunTime - h * 60 * 60) / 60);
            var s = Math.floor((totalRunTime - h * 60 * 60 - m * 60));
            return parseInt(h / 24) + "天" + (h % 24) + "小时" + m + "分钟" + s + "秒";
            // return {
            //   d: parseInt(h / 24),
            //   h: h,
            //   m: m,
            //   s: s
            // }; 
        } catch (error) {
            return"-天-小时-分钟-秒";
        }

      }
    },
    methods: {
      //进入身份验证界面
      toLogin: function () {
        //this.$router.push({ path: '/Login' });
        this.go("/login");
        //this.countDownTimer = this.countDownTimerMax;
      },
      toFaceLogin:function(){

        this.go("/faceLogin");
      },
      //返回按钮点击事件
      btnBackClickEvent: function () {
        //this.popupInAlert("提示信息", "请输入", 3000, function (str) {alert(str);}, function () {alert(2);}, function () {alert(3);});
        //this.showToast("请关门");
        //this.useCabinet();
        this.pageBack();
      },
      //刷新按钮点击事件
      btnUpdateEvent: function () {
        this.updateUserInfoData();
      },
      //用户自定义方法————————————————————————————————————————————————————————————————————————————————————————————————
      updateInfo: function () {
        try {
          CabOpt.GetMainInfo();
        } catch (e) {}
      },
      setMainInfo: function (jsonStr) {
        var jsonObj = JSON.parse(jsonStr);
        if (jsonObj.Status == 1) {
          $("#putNum").text(jsonObj.Data.todayPutInCount);
          $("#useNum").text(jsonObj.Data.todayUseCount);
          $("#returnNum").text(jsonObj.Data.todayReturnCount);
          $("#expireNum").text(jsonObj.Data.expiredDrugCount);
          $("#temHum").text(
            Cab.GetTem().toString() + " " + Cab.GetHum().toString()
          );
          //this.overviewInfo.putNum = jsonObj.Data.todayPutInCount;
          //this.overviewInfo.useNum = jsonObj.Data.todayUseCount;
          //this.overviewInfo.returnNum = jsonObj.Data.todayReturnCount;
          //this.overviewInfo.expireNum = jsonObj.Data.expiredDrugCount;
          //this.overviewInfo.temHum = Cab.GetTem().toString() + " " + Cab.GetHum().toString();
        }
      },
      getStandbyInfoCallback:function(obj){
        if(obj.status!=0)
        {
        
          this.$toast.error(obj.message);
        
        }
        else 
        {
          this.overviewInfo.putNum = obj.data.todayPutInCount;
          this.overviewInfo.useNum = obj.data.todayUseCount;
          this.overviewInfo.returnNum = obj.data.todayReturnCount;
          this.overviewInfo.expireNum = obj.data.expiredDrugCount;
        }
      },
      temControlDisplay:function(flowIndex){
 	       switch (flowIndex) {
 	         case '1':
              this.temControlflowStr= this.$parent.temControlflowStr="正在控温...";
 	            break;
 	          case '2':
              this.temControlflowStr= this.$parent.temControlflowStr="正在化霜...";
               break;
 	          case '3':
              this.temControlflowStr= this.$parent.temControlflowStr="未进行";
 	            break;
 	        
 	          default:
 	            break;
 	        }
 	
 	      },
      beforeDestroy: function () {
      clearInterval(this.intervalId);
    },
    },
    mounted: function () {
      console.log(9999999999999999999999)
      this.$parent.userInfo = null;
      P_Client.closeVideoDisplay();
      var that = this;
      P_Face.stopWork();
      P_Face.initFaceList(that.$parent.clientInfo.CustomerId);
      this.intervalId=setInterval(function(){
        P_ClientCom.getTemHumInfo(function(result){
            var obj=JSON.parse(result);
            that.overviewInfo.tem=obj.data.Tem;
            that.overviewInfo.hum=obj.data.Hum;
            that.temControlDisplay(obj.data.ControlTemFlowIndex);
        });
      },1000);
      P_ClientCom.cancelUseClient();
    }
  };
</script>
